package org.laobai.permission.config;

import org.laobai.permission.entity.User;
import org.springframework.stereotype.Component;

/**
 * @author jiusan
 */
@Component
public class UserThreadLocal  {

    private ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    public void setUser(User user) {
        userThreadLocal.set(user);
    }


    public User getUser() {
        return userThreadLocal.get();
    }

    public void removeUser(){
        userThreadLocal.remove();
    }
}
